<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use App\Services\RobotService;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Queue\ShouldBeUnique;

class RobotMessageJob
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $sleep;

    public $timeout;

    public $articleId;

    public function __construct(int $articleId)
    {
        $this->timeout = 60;

        $this->articleId = $articleId;

        $this->connection = 'redis';
    }

    public function handle()
    {
        $robotService = new RobotService();
        $robotService->sendRobot($this->articleId);
    }
}
